<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
	<script type="text/javascript">
		function CheckFileExistence(elementName) {
			var filePath = document.getElementById(elementName).value;
			if (filePath.length < 1) {
				alert("File Name cannot be empty");
				return false;
			}
		}
	</script>
	<p>
   <h2>Add students</h2>
    <%= Html.ValidationSummary("Het importeren van de studenten is mislukt. Lost de volgende fouten op en probeer opnieuw: ")%>
<%
	using(Html.BeginForm("UploadNewStudent", "Upload", FormMethod.Post, new { enctype = "multipart/form-data" }))
	{
%>
	<fieldset>
		<legend>Upload student file</legend>
		<p>
			<label>Download template:</label>
			<a href="../Downloads/student_template.csv">Student template</a>
		</p>
		<p>
			<label for="File">Select file: </label>
			<input type="file" id="studentUpload" name="studentUpload" size="23"/>
			<input type="submit" onclick="return CheckFileExistence('studentUpload')" value="Upload file" />
		</p>
	</fieldset>
<%
	}
%>
	</p>
	<p>
	<h2>Add student groups</h2>
<%
	using(Html.BeginForm("UploadNewGroup", "Upload", FormMethod.Post, new { enctype = "multipart/form-data" }))
	{
%>
	<fieldset>
		<legend>Upload group file</legend>
		<p>
			<label>Download template:</label>
			<a href="../Downloads/group_template.csv">Group template</a>
		</p>
		<p>
			<label for="File">Select file: </label>
			<input type="file" id="groupUpload" name="groupUpload" size="23"/>
			<input type="submit" onclick="return CheckFileExistence('groupUpload')" value="Upload file" />
		</p>
	</fieldset>
<%
	}
%>
	</p>
</asp:Content>
